package com.txm.qqcommon;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/*
 * 用于存放客户端和服务端通讯的消息
 * */
public class Message implements Serializable {
    private static final long serialVersionUID = 1L;
    private String sender; //发送者
    private String getter; //接收者
    private String content; //发送的内容
    private String sendTime; //发送的时间
    private String msgType; //消息的类型
    private Object object; //对象数据

    public Message() {
    }

    public Message(String sender, String getter, String content, String sendTime, String msgType, Object object) {
        this.sender = sender;
        this.getter = getter;
        this.content = content;
        this.sendTime = sendTime;
        this.msgType = msgType;
        this.object = object;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public void setCurrentLocalDate() {
        this.sendTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
    }

    public static String getLocalDate() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public String getGetter() {
        return getter;
    }

    public void setGetter(String getter) {
        this.getter = getter;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSendTime() {
        return sendTime;
    }

    public void setSendTime(String sendTime) {
        this.sendTime = sendTime;
    }

    public String getMsgType() {
        return msgType;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }

    @Override
    public String toString() {
        return "Message{" +
                "sender='" + sender + '\'' +
                ", getter='" + getter + '\'' +
                ", content='" + content + '\'' +
                ", sendTime='" + sendTime + '\'' +
                ", msgType='" + msgType + '\'' +
                ", object=" + object +
                '}';
    }
}
